package de.hauschild.gmltracer.gml.impl.value.point;

import org.apache.commons.math.geometry.Vector3D;

import de.hauschild.gmltracer.gml.Environment;
import de.hauschild.gmltracer.gml.TokenStack;
import de.hauschild.gmltracer.gml.impl.AbstractToken;
import de.hauschild.gmltracer.gml.impl.value.real.RealToken;

public abstract class OnePointOperatorToken extends AbstractToken {

  @Override
  public void evaluate(final Environment environment, final TokenStack tokenStack) {
    final PointToken point = tokenStack.pop(PointToken.class);

    tokenStack.push(new RealToken(compute(point.getValue())));
  }

  protected abstract double compute(final Vector3D value);

}
